<?php
/**
 * @author qingyu8@staff.weibo.com
 * @date 2018/03/11
 */
namespace common\logic;

use common\models\Order;
use common\models\OrderStatusFlow;
use common\logic\OrderStatus;
use common\logic\SupplyStatus;
use common\logic\PaymentStatus;
use common\logic\AccountStatus;

class OrderStatusEntire {

    public static function change($orderId, $data = []) {
        $statusParam = [];
        foreach ($data as $item) {
            switch ($item['statusType']) {
                case OrderStatusFlow::TYPE_ORDER:
                    $statusParam['order_status'] = $item['value'];
                    break;
                case OrderStatusFlow::TYPE_SUPPLY:
                    $statusParam['supply_status'] = $item['value'];
                    break;
                case OrderStatusFlow::TYPE_PAYMENT:
                    $statusParam['payment_status'] = $item['value'];
                    break;
                case OrderStatusFlow::TYPE_ACCOUNT:
                    $statusParam['account_status'] = $item['value'];
                    break;
            }
        }
        Order::update($statusParam, "orderId=>");
    }

    public static function addStatusFlow($orderId, $type, $status, $reason, $ext = []) {

    }

    public static function getStatusFlow($orderId, $type) {

    }

    public static function getStatusFlowAdmin($orderId, $type) {

    }

}
